package com.tuananh.radnom.model.event;

import java.io.IOException;
import java.util.HashMap;

import javax.xml.transform.Result;

import org.springframework.oxm.XmlMappingException;

public class NmsEvent {
	protected String name;
	protected Object data;
	protected HashMap<String, String> headers = new HashMap<String, String>();

	public HashMap<String, String> getHeaders() {
		if (headers == null)
			headers = new HashMap<String, String>();
		return headers;
	}

	public void setHeaders(HashMap<String, String> headers) {
		this.headers = headers;
	}

	public NmsEvent() {
	}

	public NmsEvent(String name, Object data, HashMap<String, String> headers) {
		this.name = name;
		this.headers = headers;
		this.data = data;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public void marshall(Result result) {
		try {
			EventReporter.marshaller.marshal(data, result);
		} catch (XmlMappingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
